package com.lagou.edu.utils;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
 * Created by zl on 2018/7/7.
 */
public class BeanFactoryUtil implements ApplicationContextAware {
    protected static ApplicationContext ctx = null;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        ctx = applicationContext;
    }

    public static Object getBean(String beanId) {
        return ctx.getBean(beanId);
    }
}
